package com.youtills.core.auth.db.dao;


import com.youtills.core.auth.IAuth;
import com.youtills.core.auth.IAuthorization;
import com.youtills.core.auth.Resource;

import java.util.Date;

/**
 * Created by IntelliJ IDEA.
 * User: ravi
 * Date: 8/27/12
 * Time: 11:54 AM
 * To change this template use File | Settings | File Templates.
 */
public class Authorization implements IAuthorization {

    private IAuth auth;
    private Resource targetResource;
    private boolean allowed;
    private boolean denied;
    private Date createdDate;
    private Date modifiedDate;

    public IAuth getAuth() {
        return auth;
    }

    public void setAuth(IAuth auth) {
        this.auth = auth;
    }

    public Resource getTargetResource() {
        return targetResource;
    }

    public void setTargetResource(Resource targetResource) {
        this.targetResource = targetResource;
    }

    public boolean isAllowed() {
        return allowed;
    }

    public void setAllowed(boolean allowed) {
        this.allowed = allowed;
    }

    public boolean isDenied() {
        return denied;
    }

    public void setDenied(boolean denied) {
        this.denied = denied;
    }

    public boolean hasAuthorization() {
        return allowed && !denied;
    }

    public Date getCreatedDate() {
        return createdDate;
    }

    public void setCreatedDate(Date createdDate) {
        this.createdDate = createdDate;
    }

    public Date getModifiedDate() {
        return modifiedDate;
    }

    public void setModifiedDate(Date modifiedDate) {
        this.modifiedDate = modifiedDate;
    }
}
